# 默认目标
.PHONY: help build run migrate test clean

# 显示帮助信息
help:
	@echo "Usage: make [target]"
	@echo ""
	@echo "Available targets:"
	@echo "  build     构建项目"
	@echo "  run       运行项目"
	@echo "  migrate   数据库迁移"
	@echo "  test      运行测试"
	@echo "  clean     清理构建文件"
	@echo "  help      显示此帮助信息"

# 构建项目
build:
	go build -o bin/server cmd/server/main.go
	go build -o bin/migrate scripts/migrate.go
	cp config.yaml bin/config.yaml

# 运行项目
run: build
	./bin/server

# 数据库迁移
migrate: build
	./bin/migrate

# 运行测试
test:
	go test ./...

# 清理构建文件
clean:
	rm -f bin/server bin/migrate